<script>
	import {
		getUserInfo,
	} from '@/services/base.js'
	export default {
		onLaunch: async function() {
			console.log('App Launch')
			const token = uni.getStorageSync('token')
			console.log(token)
			const userConfig = uni.getStorageSync('userConfig')
			if (!!token) {
				const userInfo = await getUserInfo()
				console.log(userInfo, '1234')
			} else {
				// 修复：检查当前页面是否已经是登录页面，避免循环重定向
				const currentPage = getCurrentPages()[0];
				if (!currentPage || !currentPage.route.includes('phoneLogin')) {
					uni.redirectTo({
						url: '/pages/login/phoneLogin'
					})
				}
			}
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		}
	}
</script>

<style>
	/*每个页面公共css */
</style>